Skip to content

Conversation

@zmoon
Copy link
Owner

@zmoon zmoon commented Jan 16, 2026

Now using anywidget for the display (_repr_html_)

More ways to use abcjs:

  • headless SVG creation via Node.js (pyabc2.sheet, not sure about the module name)
  • create/open HTML page
  • interactive toy editor widget in the notebook using ipywidgets
    • planning to keep this as an example (in the notebook) but create an editor widget in js, so that the interactivity fully works in the docs

todo:

  • document the widget attrs
  • cov

zmoon added 30 commits November 29, 2024 10:25
- seems like abcjs is not ES6 so can't `import`
- loading from CDN happens on widget creation, but not update
- but currently creation controls where it shows up
  (the first #music, though update creates additional elements)
without needing to override __init__
seems like restarting notebook kernel won't get you to the first
load, have to refresh the web page

and it would be nice to display it at the same hierarchy level
as the widget container, instead of within it

could also add an option to include it within the widget when
requested
tune.engraver.svgs also them, but not sure if the same thing or not
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PyABC2 library to use abcjs version 6.4.4 and adds comprehensive widget-based rendering capabilities for ABC notation. The changes modernize the display system by replacing the previous custom JavaScript injection approach with anywidget, and add multiple new ways to render ABC notation including headless SVG creation via Node.js and HTML page generation.

Changes:

  • Replaced custom abcjs loading in Tune._repr_html_() with an anywidget-based implementation
  • Added pyabc2.widget module with ABCJSWidget class and interactive() function for Jupyter integration
  • Added pyabc2.sheet module for headless SVG rendering via Node.js with abcjs
  • Added pyabc2.html module for generating standalone HTML pages with embedded ABC rendering
  • Updated ReadTheDocs configuration to build Node.js dependencies and use Python 3.14 (invalid version)

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
pyproject.toml Added optional dependency groups for 'widget' and 'sheet' extras, updated sphinx constraint, added anywidget to dev dependencies
pyabc2/widget/index.js New JavaScript module implementing anywidget interface for abcjs rendering with support for customization options
pyabc2/widget/index.css Styling for widget debug modes and code display
pyabc2/widget/init.py Python widget implementation with ABCJSWidget class and interactive editor function
pyabc2/sheet/render.js Node.js module for headless SVG rendering using abcjs and jsdom
pyabc2/sheet/package.json NPM package definition for abcjs rendering dependencies
pyabc2/sheet/cli.cjs Command-line interface for Node.js rendering
pyabc2/sheet/init.py Python interface to Node.js rendering with svg() and svg_to() functions
pyabc2/parse.py Updated Tune.repr_html() to use new widget, removed old abcjs loading code
pyabc2/html.py New module for generating standalone HTML pages with abcjs rendering
pyabc2/_util.py Added in_jupyter() utility function
pyabc2/init.py Removed automatic abcjs loading call
docs/index.md Added widget example notebook to documentation index
docs/examples/widget.ipynb Comprehensive examples demonstrating widget usage
docs/examples/types.ipynb Added anchor reference for Tune type
docs/dev.md Added documentation for widget development with hot reloading
docs/conf.py Added abcjs script loading configuration for documentation
docs/api.rst Added API documentation sections for widget and sheet modules
.readthedocs.yaml Updated OS version, Python version to 3.14 (invalid), added pre-build job for npm install
.gitignore Added patterns for node_modules, test files, and build artifacts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

zmoon and others added 2 commits January 15, 2026 22:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zmoon zmoon changed the title Update abcjs version for Tune display and add additional tools Update abcjs version for Tune display and add additional abcjs-based tools Jan 16, 2026
@zmoon zmoon marked this pull request as ready for review January 17, 2026 05:24
@zmoon zmoon requested a review from Copilot January 17, 2026 05:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zmoon
Copy link
Owner Author

zmoon commented Jan 17, 2026

I don't know why codecov is reporting Eskin coverage so low. Those tests are running. Just going to merge for now.

@zmoon zmoon merged commit 7e1f2f0 into main Jan 17, 2026
8 of 9 checks passed
@zmoon zmoon deleted the anywidget branch January 17, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants